package components;

import java.awt.Graphics;
import java.awt.Image;
import java.awt.LayoutManager;

import javax.swing.JPanel;

@SuppressWarnings("serial")
public class JImagePanel extends JPanel{

	Image img;
	
	public JImagePanel() {
		super();
	}

	public JImagePanel(LayoutManager layout) {
		super(layout);
	}

	public Image getImage() {
		return img;
	}

	public void setImage(Image img) {
		this.img = img;
		repaint();
	}

	@Override
	public void paint(Graphics g) {
		super.paint(g);  
        if (img != null)
            g.drawImage(img, 1, 1, this);
	}

	public void clearImage() {
		img = null;
		repaint();
	}

}
